!
!
!
      subroutine PLUTOELL (tjd,r,ierr)
!-----------------------------------------------------------------------
!
!     Ref : 9903.
!
!     Pluto : Elliptic coordinates (Ecliptic J2000).
!
! --- Input ------------------------------------------------------------
!
!     tjd    Julian Date (double precision).
!
! --- Output -----------------------------------------------------------
!
!     r(6)   Elliptic coordinates (double precision).
!            r(1) = semi-major axis (au).
!            r(2) = mean longitude (rad).
!            r(3) = h = e * sin(pi).
!            r(4) = k = e * cos(pi).
!            r(5) = p = g * sin(om).
!            r(6) = q : g * cos(om).
!            with :
!            e    : eccentricity.
!            g    : sine of semi inclination.
!            pi   : longitude of perihelion.
!            om   : longitude of ascending node.
!
!     ierr   Error index (integer).
!            0 : no error.
!            1 : time error.
!
! --- Remark -----------------------------------------------------------
!
!     The Julian Date tjd is included between 626403.5 (-2997 Jan 1) and
!     2810943.5 (2984 Jan 1)
!
! --- Declarations -----------------------------------------------------
!
      implicit double precision (a-h,o-z)
!
      dimension r(6)
!
      save
!
! --- Initialization ---------------------------------------------------
!
      parameter (dpi=6.283185307179586d0)
      parameter (tmin=626403.5d0,tmax=2810578.5d0)
!
! --- Date test --------------------------------------------------------
!
      if (tjd.lt.tmin.or.tjd.gt.tmax) then
         ierr=1
         return
      endif
!
      t=(tjd-2451545.d0)/36525d0
      t2=t*t
      t3=t*t2
!
! --- Time substitution ------------------------------------------------
!
      r(1)=
     . 39.5404d0
     . +0.004471d0 * t
     . +0.0315d0          * sin (  2.545150d0 * t + 1.8271d0 )
     . +0.0490d0          * sin ( 18.787117d0 * t + 4.4687d0 )
     . +0.0536d0          * sin ( 47.883664d0 * t + 3.8553d0 )
     . +0.2141d0          * sin ( 50.426476d0 * t + 4.1802d0 )
     . +0.0004d0          * sin ( 47.883664d0 * t + 4.1379d0 )
     . +0.0066d0          * sin ( 50.426476d0 * t + 5.1987d0 )
     . +0.0091d0          * sin ( 47.883664d0 * t + 5.6881d0 )
     . +0.0200d0          * sin ( 50.426476d0 * t + 6.0165d0 )
     . +0.000018d0 * t    * sin ( 47.883664d0 * t + 4.1379d0 )
     . +0.000330d0 * t    * sin ( 50.426476d0 * t + 5.1987d0 )
     . +0.000905d0 * t    * sin ( 47.883664d0 * t + 5.6881d0 )
     . +0.001990d0 * t    * sin ( 50.426476d0 * t + 6.0165d0 )
     . +0.00002256d0 * t2 * sin ( 47.883664d0 * t + 5.6881d0 )
     . +0.00004958d0 * t2 * sin ( 50.426476d0 * t + 6.0165d0 )
!
      r(2)=
     .  4.1702d0
     . +2.533953d0     * t
     . -0.00021295d0   * t2
     . +0.0000001231d0 * t3
     . +0.0014d0          * sin (  0.199159d0 * t + 5.8539d0 )
     . +0.0050d0          * sin (  0.364944d0 * t + 1.2137d0 )
     . +0.0055d0          * sin (  0.397753d0 * t + 4.9469d0 )
     . +0.0002d0          * sin (  2.543029d0 * t + 3.0186d0 )
     . +0.0012d0          * sin ( 18.787098d0 * t + 3.4938d0 )
     . +0.0008d0          * sin ( 18.817229d0 * t + 2.0097d0 )
     . +0.0050d0          * sin ( 50.426472d0 * t + 2.6252d0 )
     . +0.0015d0          * sin ( 52.969319d0 * t + 6.1048d0 )
     . +0.0008d0          * sin (292.208471d0 * t + 4.7603d0 )
     . +0.0008d0          * sin (292.265343d0 * t + 2.8055d0 )
     . +0.0031d0          * sin (  0.364944d0 * t + 2.7888d0 )
     . +0.0004d0          * sin (  2.543029d0 * t + 0.5111d0 )
     . +0.0003d0          * sin ( 18.787098d0 * t + 6.1336d0 )
     . +0.0000d0          * sin ( 50.426472d0 * t + 2.2515d0 )
     . +0.0004d0          * sin (292.208471d0 * t + 0.0813d0 )
     . +0.0004d0          * sin (292.265343d0 * t + 1.2477d0 )
     . +0.0004d0          * sin ( 50.426472d0 * t + 4.2694d0 )
     . +0.000156d0 * t    * sin (  0.364944d0 * t + 2.7888d0 )
     . +0.000020d0 * t    * sin (  2.543029d0 * t + 0.5111d0 )
     . +0.000017d0 * t    * sin ( 18.787098d0 * t + 6.1336d0 )
     . +0.000000d0 * t    * sin ( 50.426472d0 * t + 2.2515d0 )
     . +0.000022d0 * t    * sin (292.208471d0 * t + 0.0813d0 )
     . +0.000022d0 * t    * sin (292.265343d0 * t + 1.2477d0 )
     . +0.000044d0 * t    * sin ( 50.426472d0 * t + 4.2694d0 )
     . +0.00000110d0 * t2 * sin ( 50.426472d0 * t + 4.2694d0 )
!
      r(2)=mod(r(2),dpi)
      if (r(2).lt.0.d0) r(2)=r(2)+dpi
!
      r(3)=
     . -0.1733d0
     . -0.000013d0 * t
     . +0.0012d0          * sin (  2.541849d0 * t + 3.9572d0 )
     . +0.0008d0          * sin ( 21.329808d0 * t + 0.8858d0 )
     . +0.0012d0          * sin ( 47.883781d0 * t + 1.4929d0 )
     . +0.0005d0          * sin ( 50.426641d0 * t + 5.3286d0 )
     . +0.0037d0          * sin ( 52.969135d0 * t + 0.6139d0 )
!
      r(4)=
     . -0.1787d0
     . -0.000070d0 * t
     . +0.0006d0          * sin (  2.512561d0 * t + 3.8516d0 )
     . +0.0013d0          * sin (  2.543100d0 * t + 0.0218d0 )
     . +0.0008d0          * sin ( 21.329765d0 * t + 2.4324d0 )
     . +0.0012d0          * sin ( 47.883788d0 * t + 6.2432d0 )
     . +0.0005d0          * sin ( 50.426611d0 * t + 3.0920d0 )
     . +0.0038d0          * sin ( 52.969155d0 * t + 2.1566d0 )
     . +0.0004d0          * sin (  2.512561d0 * t + 5.3919d0 )
     . +0.000022d0 * t    * sin (  2.512561d0 * t + 5.3919d0 )
!
      r(5)=
     . +0.1398d0
     . +0.000007d0 * t
     . +0.0002d0          * sin ( 50.426871d0 * t + 0.6705d0 )
     . +0.0002d0          * sin ( 55.512211d0 * t + 6.0770d0 )
!
      r(6)=
     . -0.0517d0
     . +0.000020d0 * t
     . +0.0002d0          * sin ( 50.426859d0 * t + 5.4131d0 )
     . +0.0002d0          * sin ( 55.512206d0 * t + 1.3314d0 )
!
      ierr=0
      return
!
      end
!
!
!
